function res = multisimp(fun,xl,xr,n)
% MULTISIMP - 用复合simpson公式求fun函数从xl到xr的积分
%   
%   
    h = (xr - xl)/n;
    points = xl:h:xr;
    F = fun(points);
    mid = (points(1:n)+points(2:n+1))/2;
    FF = fun(mid);
    res = h/6*(sum(F(1:n))+sum(F(2:(n+1)))+4*sum(FF));
end

